/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package assignmentbuilder;

/**
 *
 * @author alhshk
 */
public class Author implements Comparable<Author> {

  private String firstName;
  private String lastName;
  private String email;
  private String phone;
  private String affiliation;
  private String url;

  public Author() {
  }

  public Author(String firstName, String lastName, String email, String phone, String affiliation, String url) {
    this.firstName = firstName;
    this.lastName = lastName;
    this.email = email;
    this.phone = phone;
    this.affiliation = affiliation;
    this.url = url;
  }

  public String getAffiliation() {
    return affiliation;
  }

  public void setAffiliation(String affiliation) {
    this.affiliation = affiliation;
  }

  public String getEmail() {
    return email;
  }

  public void setEmail(String email) {
    this.email = email;
  }

  public String getFirstName() {
    return firstName;
  }

  public void setFirstName(String firstName) {
    this.firstName = firstName;
  }

  public String getLastName() {
    return lastName;
  }

  public void setLastName(String lastName) {
    this.lastName = lastName;
  }

  public String getPhone() {
    return phone;
  }

  public void setPhone(String phone) {
    this.phone = phone;
  }

  public String getUrl() {
    return url;
  }

  public void setUrl(String url) {
    this.url = url;
  }

  @Override
  public boolean equals(Object obj) {
    if (obj == null) {
      return false;
    }
    if (getClass() != obj.getClass()) {
      return false;
    }
    final Author other = (Author) obj;
    if ((this.email == null) ? (other.email != null) : !this.email.equals(other.email)) {
      return false;
    }
    return true;
  }

  @Override
  public int hashCode() {
    int hash = 7;
    hash = 47 * hash + (this.email != null ? this.email.hashCode() : 0);
    return hash;
  }

  public int compareTo(Author a) {
    int result = lastName.compareTo(a.lastName);
    if (result == 0) {
      result = firstName.compareTo(a.firstName);
    }
    return result;
  }
}
